#include<stdio.h>
#include<unistd.h>
#include<string.h>
#include<sys/types.h>
#include<sys/stat.h>
#include<fcntl.h>

int main()
{
  char input[16];
  ssize_t s1= read(0,input,sizeof(input));
  if(s1>0)
  {
    input[s1]='\0';
  }

  fprintf(stdout ,"this is fptrintf\n");
  const char* s="这是要往标准输出流中写入的\n";
  write(1,s,strlen(s));











  /*
  //为当前进程限制权限
  umask(0);//设置默认限制的权限为0，意思是不限制权限 
  //相当于c语言中fopen("log.txt","w"),fopen函数对open 函数做了封装，一个w对应底层open函数第二个参数的三个权限位
  int fd=open("log.txt",O_WRONLY|O_CREAT|O_TRUNC,0666);//第二个参数是要打开文件享受到的权限，第三个参数是生成文件时赋予的权限
  if(fd<0)
  {
    //打开失败
    perror("open");
    return 1;
  }

 // char*s="hello bit";
 char*s="aa\n";
  write(fd,s,strlen(s));//不用+1
  printf("open success,fg:%d\n",fd);
  close(fd);*/
  return 0;





}

























































/*
#define ONE 0x1
#define TWO 0x2// 0000 0010
#define THREE 0X4//0000 0100
*/

/*
void show(int flags)
{
  if(flags&ONE)
  {
  printf("hello one\n");
  }
  if(flags&TWO)
  printf("hello two\n");
  if(flags&THREE)
  printf("hello three\n");
}

int main()
{
  show(ONE);
  show(TWO);
  show(ONE | TWO);
  show(ONE|TWO|THREE);
  show(ONE|THREE);
  return 0;
}*/
